<template>
  <div class="newSongs" :class="[`${program + 'newsongs-' + theme}`]">
    <h4 class="top">最新音乐</h4>
    <div class="content">
      <div class="item" v-for="(item, index) in musicList" :key="index" @dblclick="playMusic(index)">
        <div class="title">
          <img v-lazy="item.picUrl" alt />
          <div class="icon">
            <i class="iconfont iconbofang1"></i>
          </div>
        </div>
        <div class="mess">
          <div class="name">{{ item.name }}</div>
          <div class="singer">{{ artists(item) }}</div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { theme } from "mixin/global/theme";
import { playMusic } from 'mixin/global/play-music'
/* 待完成 单击封面 播放歌曲 双击mess 进入歌曲详情 单击歌手 进入歌手详情*/

export default {
  name: "newSongs",
  mixins: [theme,playMusic],
  props: {
    musicList: {
      type: Array,
      default: () => [],
    },
  },
   computed: {
        artists() {
          return (item) => {
            let artists = [];
            item.song.album.artists.map((artist, index) => {
              artists.push(artist.name);
            });
            return artists.join("/");
          };
        },
      },
  data() {
    return {};
  },
};
</script>
<style lang="less" scoped>
.newSongs {
  height: auto;
}
.content {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  padding: 0 10px;
}
.item {
  width: 50%;
  height: 100%;
  display: flex;
  margin: 10px 0;
}
.item:hover {
  border-radius: 5px;
  background: rgba(90, 90, 90, 0.2);
}
.title {
  height: 100%;
  position: relative;
}
.title img {
  height: 82px;
  border-radius: 5px;
  cursor: pointer;
}

.icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgb(232, 232, 232);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}
.icon .iconbofang1 {
  color: rgb(236, 65, 65);
  margin-left: 4px;
}
.top {
  margin-top: 10px;
}
.mess {
  width: 100%;
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  margin-left: 5px;
  cursor: default;
}
.singer {
  font-size: 14px;
  color: rgb(90, 90, 90);
  cursor: pointer;
}
.singer:hover {
  color: rgb(17, 14, 14);
}
</style>